<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content=
    "application/xhtml+xml; charset=iso-8859-1" />
    <title>
      Java-12.0.2
    </title>
    <link rel="stylesheet" type="text/css" href="../stylesheets/lfs.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.79.1" />
    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=
    "text/css" media="print" />
  </head>
  <body class="blfs" id="blfs-9.1">
    <div class="navheader">
      <h4>
        Beyond Linux<sup>�</sup> From Scratch <span class="phrase">(System
        V</span> Edition) - Version 9.1
      </h4>
      <h3>
        Chapter&nbsp;13.&nbsp;Programming
      </h3>
      <ul>
        <li class="prev">
          <a accesskey="p" href="other-tools.html" title=
          "Other Programming Tools">Prev</a>
          <p>
            Other Programming Tools
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="openjdk.html" title=
          "OpenJDK-12.0.2">Next</a>
          <p>
            OpenJDK-12.0.2
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="prog.html" title=
          "Chapter&nbsp;13.&nbsp;Programming">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 9.1">Home</a>
        </li>
      </ul>
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <h1 class="sect1">
        <a id="java" name="java"></a>Java-12.0.2
      </h1>
      <div class="sect2" lang="en" xml:lang="en">
        <h2 class="sect2">
          About Java
        </h2>
        <p>
          Java is different from most of the packages in LFS and BLFS. It is
          a programming language that works with files of byte codes to
          obtain instructions and executes then in a Java Virtual Machine
          (JVM). An introductory java program looks like:
        </p>
        <pre class="screen">
<code class="literal">public class HelloWorld
{
    public static void main(String[] args)
    {
        System.out.println("Hello, World");
    }
}</code>
</pre>
        <p>
          This program is saved as <code class=
          "filename">HelloWorld.java</code>. The file name, <span class=
          "emphasis"><em>HelloWorld</em></span>, must match the class name.
          It is then converted into byte code with <span class=
          "command"><strong>javac HelloWorld.java</strong></span>. The output
          file is <code class="filename">HelloWorld.class</code>. The program
          is executed with <span class="command"><strong>java
          HelloWorld</strong></span>. This creates a JVM and runs the code.
          The 'class' extension must not be specified.
        </p>
        <p>
          Several class files can be combined into one file with the
          <span class="command"><strong>jar</strong></span> command. This is
          similar to the standard <span class=
          "command"><strong>tar</strong></span> command. For instance, the
          command <span class="command"><strong>jar cf myjar.jar
          *.class</strong></span> will combine all class files in a directory
          into one jar file. These act as library files.
        </p>
        <p>
          The JVM can search for and use classes in jar files automatically.
          It uses the <code class="envar">CLASSPATH</code> environment
          variable to search for jar files. This is a standard list of
          colon-separated directory names similar to the <code class=
          "envar">PATH</code> environment variable.
        </p>
      </div>
      <div class="package" lang="en" xml:lang="en">
        <h2 class="sect2">
          <a id="java-bin" name="java-bin"></a>Binary JDK Information
        </h2>
        <p>
          Creating a JVM from source requires a set of circular dependencies.
          The first thing that's needed is a set of programs called a Java
          Development Kit (JDK). This set of programs includes <span class=
          "command"><strong>java</strong></span>, <span class=
          "command"><strong>javac</strong></span>, <span class=
          "command"><strong>jar</strong></span>, and several others. It also
          includes several base <span class="emphasis"><em>jar</em></span>
          files.
        </p>
        <p>
          To start, we set up a binary installation of the JDK created by the
          BLFS editors. It is installed in the <code class=
          "filename">/opt</code> directory to allow for multiple
          installations, including a source based version.
        </p>
        <p>
          This package is known to build and work properly using an LFS-9.1
          platform.
        </p>
        <h3>
          Binary Package Information
        </h3>
        <div class="itemizedlist">
          <ul class="compact">
            <li class="listitem">
              <p>
                Binary download (x86): <a class="ulink" href=
                "http://anduin.linuxfromscratch.org/BLFS/OpenJDK/OpenJDK-11.0.2/OpenJDK-11.0.2+9-i686-bin.tar.xz">
                http://anduin.linuxfromscratch.org/BLFS/OpenJDK/OpenJDK-11.0.2/OpenJDK-11.0.2+9-i686-bin.tar.xz</a>
              </p>
            </li>
            <li class="listitem">
              <p>
                Download MD5 sum: 2b917647040e9804e0f3ccd51f40394b
              </p>
            </li>
            <li class="listitem">
              <p>
                Download size (binary): 158 MB
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated disk space required: 273 MB
              </p>
            </li>
          </ul>
        </div>
        <div class="itemizedlist">
          <ul class="compact">
            <li class="listitem">
              <p>
                Binary download (x86_64): <a class="ulink" href=
                "https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/10/GPL/openjdk-12.0.2_linux-x64_bin.tar.gz">
                https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/10/GPL/openjdk-12.0.2_linux-x64_bin.tar.gz</a>
              </p>
            </li>
            <li class="listitem">
              <p>
                Download MD5 sum: f5da6f4dec81bdd2a096184ec1d69216
              </p>
            </li>
            <li class="listitem">
              <p>
                Download size (binary): 189 MB
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated disk space required: 296 MB
              </p>
            </li>
          </ul>
        </div>
        <h3>
          Java Binary Runtime Dependencies
        </h3>
        <p class="required">
          <a class="xref" href="../multimedia/alsa-lib.html" title=
          "alsa-lib-1.2.1.2">alsa-lib-1.2.1.2</a>, <a class="xref" href=
          "../pst/cups.html" title="Cups-2.3.1">Cups-2.3.1</a>, <a class=
          "xref" href="giflib.html" title="giflib-5.2.1">giflib-5.2.1</a>,
          and <a class="xref" href="../x/x7lib.html" title=
          "Xorg Libraries">Xorg Libraries</a>
        </p>
      </div>
      <div class="installation" lang="en" xml:lang="en">
        <h2 class="sect2">
          Installation of the Java BinaryJDK
        </h2>
        <p>
          Begin by extracting the appropriate binary tarball for your
          architecture and changing to the extracted directory. Install the
          binary <span class="application">OpenJDK</span> with the following
          commands as the <code class="systemitem">root</code> user:
        </p>
        <pre class="root">
<kbd class="command">install -vdm755 /opt/OpenJDK-12.0.2+10-bin &amp;&amp;
mv -v * /opt/OpenJDK-12.0.2+10-bin         &amp;&amp;
chown -R root:root /opt/OpenJDK-12.0.2+10-bin</kbd>
</pre>
        <p>
          The binary version is now installed. You may create a symlink to
          that version by issuing, as the <code class=
          "systemitem">root</code> user:
        </p>
        <pre class="root">
<kbd class="command">ln -sfn OpenJDK-12.0.2+10-bin /opt/jdk</kbd>
</pre>
        <p>
          You may now proceed to <a class="xref" href="ojdk-conf.html" title=
          "Configuring the JAVA environment">Configuring the JAVA
          environment</a>, where the instructions assume that the above link
          exists.
        </p>
      </div>
      <p class="updated">
        Last updated on 2020-02-18 12:45:12 -0800
      </p>
    </div>
    <div class="navfooter">
      <ul>
        <li class="prev">
          <a accesskey="p" href="other-tools.html" title=
          "Other Programming Tools">Prev</a>
          <p>
            Other Programming Tools
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="openjdk.html" title=
          "OpenJDK-12.0.2">Next</a>
          <p>
            OpenJDK-12.0.2
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="prog.html" title=
          "Chapter&nbsp;13.&nbsp;Programming">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 9.1">Home</a>
        </li>
      </ul>
    </div>
  </body>
</html>
